#!/bin/bash
#description: 安装 nfs容器

cat > /data/nfs.yaml << EOF
services:
  nfs-server:
    image: registry.cn-hangzhou.aliyuncs.com/bd_xlq/nfs-server:latest
    restart: always
    network_mode: host
    ipc: host
    uts: host
    privileged: true
    volumes:
    - /data/iso:/data/iso
    environment:
      - HOST_PROC=/hostfs/proc
      - HOST_MOUNT_PREFIX=/hostfs
EOF

docker compose -f /data/nfs.yaml up -d

# bash <(curl -fsSL https://gitee.com/wind-forest-water-clear/work/raw/master/bd/nfs_docker.sh)

: << !
docker rm -f nfs-server 2> /dev/null
docker pull registry.cn-hangzhou.aliyuncs.com/bd_xlq/nfs-server:latest
docker tag registry.cn-hangzhou.aliyuncs.com/bd_xlq/nfs-server:latest nfs-server:latest
docker run -v /data/iso:/data/iso --network=host --privileged=true -e "container=docker" --name=nfs-server -d nfs-server:latest /usr/sbin/init
docker exec -it nfs-server systemctl start nfs && echo "nfs已部署好"
!